﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using core;

namespace comix
{
    public class UserBook:SiteItem, ISiteItemMember
    {
        public int bok_id;
        private Book _book;
        public Book Book
        {
            get
            {
                if (_book == null)
                {
                    _book = new Book();
                    _book.Id = bok_id;
                    _book.FillItem();
                }
                return _book;
            }
        }
        public DateTime downloaddate;
        public int downloadcount;
        public bool isSample;
        public int rate;
        public bool pending;

     

        public void FillMember(System.Data.SqlClient.SqlDataReader rdr)
        {
            bok_id = (int)rdr["u2b_bok_id"];
            downloaddate = rdr.IsDBNull(rdr.GetOrdinal("u2b_downloaddate")) ? DateTime.MinValue : (DateTime)rdr["u2b_downloaddate"];
            downloadcount = rdr.IsDBNull(rdr.GetOrdinal("u2b_downloadcount")) ? 0 : (int)rdr["u2b_downloadcount"];
            isSample = (bool)rdr["u2b_issample"];
            rate = rdr.IsDBNull(rdr.GetOrdinal("u2b_rate")) ? -1 : (int)rdr["u2b_rate"];
            pending = (bool)rdr["u2b_pending"];

        }
    }
}